package com.dream.dao.impl;

import com.dream.bean.OrderItem;
import com.dream.bean.Role;
import com.dream.dao.RoleDao;

/**
 * 概要:
 *
 * @Author:匠人码农
 * @Date:2021/12/28 23:35
 */
public class RoleDaoImpl extends BaseDao implements RoleDao {

    @Override
    public Role queryRoleByUserName(String userName) {
        String sql = "select t1.roleid,t1.rolename from t_role t1 inner join t_user_role t2 on t1.roleid = t2.roleid where t2.username = ?";
        return queryForOne(Role.class,sql,userName);
    }

    @Override
    public Role queryRoleByRoleName(String roleName) {
        String sql = "select roleid,rolename from t_role where rolename = ?";
        return queryForOne(Role.class,sql,roleName);
    }
}
